﻿using System;
using System.Linq;
using CodeCounsel.SharePoint.RibbonDesigner.Model;
using System.Collections.ObjectModel;

namespace CodeCounsel.SharePoint.RibbonDesigner.ViewModel
{
    public class GroupOverflowSectionViewModel
        : GroupSectionBaseViewModel
    {
        OverflowSection _section;
        public ObservableCollection<GroupOverflowRowViewModel> Rows { get; private set; }

        public GroupOverflowSectionViewModel(OverflowSection section)
        {
            _section = section;
            Rows = new ObservableCollection<GroupOverflowRowViewModel>();
            switch (section.Type)
            {
                case SectionType.OneRow:
                    Rows.Add(new GroupOverflowRowViewModel());
                    break;
                case SectionType.TwoRow:
                    Rows.Add(new GroupOverflowRowViewModel());
                    Rows.Add(new GroupOverflowRowViewModel());
                    break;
                case SectionType.ThreeRow:
                    Rows.Add(new GroupOverflowRowViewModel());
                    Rows.Add(new GroupOverflowRowViewModel());
                    Rows.Add(new GroupOverflowRowViewModel());
                    break;
                default:
                    throw new ArgumentException("section");
            }
        }
    }
}
